import 'package:flutter/material.dart';
import 'package:get/get_utils/get_utils.dart';
import 'package:yysk_app/utils/colors.dart';
import 'package:yysk_app/utils/helper.dart';

class CardItemWidget extends StatelessWidget {
  final EdgeInsets? padding;
  final EdgeInsets? margin;
  final BorderRadius? borderRadius;
  final Widget child;
  final String title;
  const CardItemWidget({
    super.key,
    this.padding,
    this.margin,
    this.borderRadius,
    required this.child,
    this.title = '',
  });

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        title != ''
            ? SizedBox(
              width: context.width,
              child: Text(
                title,
                style: TextStyle(
                  fontSize: 18.px,
                  fontWeight: FontWeight.w500,
                  color: AppColors.fontColorBlack.withOpacity(0.67),
                  fontFamily: 'CustomPINGFANG',
                ),
                textAlign: TextAlign.start,
              ),
            )
            : const SizedBox(),
        Container(
          padding:
              padding ??
              EdgeInsets.only(
                left: 16.px,
                top: 18.px,
                right: 16.px,
                bottom: 18.px,
              ),
          margin: margin ?? EdgeInsets.only(top: 6.px, bottom: 16.px),
          decoration: BoxDecoration(
            borderRadius: borderRadius ?? BorderRadius.circular(8.px),
            border: Border.all(color: Colors.white12),
            color: Color.fromRGBO(31, 33, 38, 1),
          ),
          child: child,
        ),
      ],
    );
  }
}
